#!/bin/bash
clear
if [[ "$EUID" -ne 0 ]]; then
    echo -e "\033[1;31mScript need to be run as root!\033[0m"; exit 1
fi

wget -q -O /usr/local/bin/dropbear-wbs 'https://raw.githubusercontent.com/cybertize/doctype/default/sources/configs/websocket/dropbear-wbs.py'
wget -q -O /usr/local/bin/openvpn-wbs 'https://raw.githubusercontent.com/cybertize/doctype/default/sources/configs/websocket/openvpn-wbs.py'
wget -q -O /usr/local/bin/stunnel-wbs 'https://raw.githubusercontent.com/cybertize/doctype/default/sources/configs/websocket/stunnel-wbs.py'
chmod +x /usr/local/bin/dropbear-wbs
chmod +x /usr/local/bin/openvpn-wbs
chmod +x /usr/local/bin/stunnel-wbs

wget -q -O /etc/systemd/system/wbs-dropbear.service 'https://raw.githubusercontent.com/cybertize/doctype/default/sources/configs/websocket/dropbear-wbs.service'
wget -q -O /etc/systemd/system/wbs-openvpn.service 'https://raw.githubusercontent.com/cybertize/doctype/default/sources/configs/websocket/openvpn-wbs.service'
wget -q -O /etc/systemd/system/wbs-stunnel.service 'https://raw.githubusercontent.com/cybertize/doctype/default/sources/configs/websocket/stunnel-wbs.service'

systemctl daemon-reload
systemctl enable wbs-dropbear; systemctl start wbs-dropbear
systemctl enable wbs-openvpn; systemctl start wbs-openvpn
systemctl enable wbs-stunnel; systemctl start wbs-stunnel

echo
echo -e "\033[1;32mCongratulation, We are done with the websocket installation.\033[0m"
echo
echo 'Use my referral link https://m.do.co/c/a28a40414d6a'
echo 'to gets $100 credit into your DigitalOcean account.'
echo 'Created by Doctype, Powered by Cybertize'
echo 'Copyright 2021, Allright reserved.'
echo; sleep 5
